package com.mall507.fivepeaks.comn.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.CountDownTimer;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import com.alibaba.android.arouter.launcher.ARouter;
import com.facebook.drawee.view.SimpleDraweeView;
import com.hzh.frame.core.ImageFrame.BaseImage;
import com.hzh.frame.util.AndroidUtil;
import com.hzh.frame.widget.xrecyclerview.BaseRecyclerAdapter;
import com.hzh.frame.widget.xrecyclerview.RecyclerViewHolder;
import com.hzh.frame.widget.xviewpager.DecoratorViewPager;
import com.hzh.frame.widget.xwebview.XWebViewActivity;
import com.mall507.fivepeaks.R;
import com.mall507.fivepeaks.activity.main.MainSpecialtyRUI;
import com.mall507.fivepeaks.comn.config.Constant;
import com.mall507.fivepeaks.comn.gsonBean.CommunityBusinessJsonBean;
import com.mall507.fivepeaks.comn.gsonBean.ShopMainJsonBean;
import com.mall507.fivepeaks.util.Util;
import com.mall507.fivepeaks.widget.Banner.BGABanner;
import com.mall507.fivepeaks.widget.imageview.CircleImageView;
import com.mall507.fivepeaks.widget.imageview.ExpandImageView;
import com.mall507.fivepeaks.widget.viewSwitcher.UpDownViewSwitcher;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author
 * @version 1.0
 * @date 2018/4/21
 */

public class ShopMainAdapter extends BaseRecyclerAdapter<ShopMainJsonBean.ItemInfoListBean> {

    private SparseArray<Integer> layouts;
    private CountDownTimer timer;
    protected Activity mActivity;

    /**
     * 加载所需要的Item布局文件及数据
     */
    public ShopMainAdapter(Activity activity, List<ShopMainJsonBean.ItemInfoListBean> list) {
        super(activity, list);
        mActivity = activity;
        if (layouts == null) {
            layouts = new SparseArray<>();
        }
        layouts.put(Constant.TYPE_TOP_BANNER, R.layout.homerecycle_item_top_banner);
        layouts.put(Constant.TYPE_ICON_LIST, R.layout.homerecycle_item_icon_list);
        layouts.put(Constant.TYPE_NEW_USER, R.layout.homerecycle_item_new_user);
        layouts.put(Constant.TYPE_JD_BULLETIN, R.layout.homerecycle_item_jd_bulletin);
        layouts.put(Constant.TYPE_JD_SPIKE_HEADER, R.layout.homerecycle_item_spike_header);
        layouts.put(Constant.TYPE_SHOW_EVENT_3, R.layout.homerecycle_item_show_event_3);
        layouts.put(Constant.TYPE_FIND_GOOD_STUFF, R.layout.homerecycle_item_find_good_stuff);
        layouts.put(Constant.TYPE_WIDTH_PROPORTION_211, R.layout.homerecycle_item_type_211);
        layouts.put(Constant.TYPE_TITLE, R.layout.homerecycle_item_type_title);
        layouts.put(Constant.TYPE_WIDTH_PROPORTION_22, R.layout.homerecycle_item_type_22);
        layouts.put(Constant.TYPE_WIDTH_PROPORTION_1111, R.layout.homerecycle_item_type_1111);
        layouts.put(Constant.TYPE_MIDDLE_BANNER, R.layout.homerecycle_item_middle_banner);
        layouts.put(Constant.TYPE_SHOW_EVENT_FILL_UP, R.layout.homerecycle_item_show_event_1);
        layouts.put(Constant.TYPE_FIND_GOOD_SHOP, R.layout.homerecycle_item_type_find_good_shop);
        layouts.put(Constant.TYPE_PREFERRED_LIST, R.layout.homerecycle_item_type_perferred_list);
        layouts.put(Constant.TYPE_LIVE, R.layout.homerecycle_item_type_live);
        layouts.put(Constant.TYPE_RECOMMENDED_WARE, R.layout.homerecycle_item_type_recommented_ware);

        layouts.put(Constant.TYPE_NEW_USER_REDUCE, R.layout.homerecycle_item_new_user_reduce);
        layouts.put(Constant.TYPE_HEAD, R.layout.homerecycle_item_head);
        layouts.put(Constant.TYPE_SHOP_ITEM, R.layout.item_rv_main_information);
        layouts.put(Constant.TYPE_PHOTO, R.layout.homerecycle_item_photo);//Item
        layouts.put(TYPE_NORMAL, R.layout.item_rv_store_main);//Item
    }

    @Override
    /**
     * 设置Item类型
     * */ public int setItemChildViewType(int position) {
        //将返回的后端Json数据Type转为本地对应的Type
        String itemType = getDatas().get(position).itemType;
        if ("topBanner".equals(itemType)) {
            return Constant.TYPE_TOP_BANNER;
        } else if ("iconList".equals(itemType)) {
            return Constant.TYPE_ICON_LIST;
        } else if ("newUser".equals(itemType)) {
            return Constant.TYPE_NEW_USER;
        } else if ("newUserReduce".equals(itemType)) {
            return Constant.TYPE_NEW_USER_REDUCE;
        } else if ("jdBulletin".equals(itemType)) {
            return Constant.TYPE_JD_BULLETIN;
        } else if ("jdSpikeHeader".equals(itemType)) {
            return Constant.TYPE_JD_SPIKE_HEADER;
        } else if ("showEvent".equals(itemType)) {
            return Constant.TYPE_SHOW_EVENT_3;
        } else if ("findGoodStuff".equals(itemType)) {
            return Constant.TYPE_FIND_GOOD_STUFF;
        } else if ("type_211".equals(itemType)) {
            return Constant.TYPE_WIDTH_PROPORTION_211;
        } else if ("type_Title".equals(itemType)) {
            return Constant.TYPE_TITLE;
        } else if ("type_22".equals(itemType)) {
            return Constant.TYPE_WIDTH_PROPORTION_22;
        } else if ("type_1111".equals(itemType)) {
            return Constant.TYPE_WIDTH_PROPORTION_1111;
        } else if ("type_middleBanner".equals(itemType)) {
            return Constant.TYPE_MIDDLE_BANNER;
        } else if ("showEventFillUp".equals(itemType)) {
            return Constant.TYPE_SHOW_EVENT_FILL_UP;
        } else if ("findGoodShop".equals(itemType)) {
            return Constant.TYPE_FIND_GOOD_SHOP;
        } else if ("preferredList".equals(itemType)) {
            return Constant.TYPE_PREFERRED_LIST;
        } else if ("live".equals(itemType)) {
            return Constant.TYPE_LIVE;
        } else if ("recommended_ware".equals(itemType)) {
            return Constant.TYPE_RECOMMENDED_WARE;
        } else if ("shopItem".equals(itemType)) {
            return Constant.TYPE_SHOP_ITEM;
        } else if ("photo".equals(itemType)) {
            return Constant.TYPE_PHOTO;
        } else if ("type_head".equals(itemType)) {
            return Constant.TYPE_HEAD;
        }
        return TYPE_NORMAL;
    }


    @Override
    /**
     * 设置Item布局
     * */ public int getItemLayoutId(int viewType) {
        return layouts.get(viewType);
    }

    @Override
    public void bindData(RecyclerViewHolder holder, int position, ShopMainJsonBean.ItemInfoListBean item) {
        if ("topBanner".equals(item.itemType)) {
            bindTopBannerData(holder, item, position);
        } else if ("iconList".equals(item.itemType)) {
            bindIconListData(holder, item, position);
        } else if ("newUser".equals(item.itemType)) {
            bindNewUserData(holder, item, position);
        } else if ("jdBulletin".equals(item.itemType)) {
            bindJDBulletinData(holder, item, position);
        } else if ("jdSpikeHeader".equals(item.itemType)) {
            bindJDSpikeHeaderData(holder, item, position);
        } else if ("showEvent".equals(item.itemType)) {
            bindShowEventData(holder, item, position);
        } else if ("findGoodStuff".equals(item.itemType)) {
            bindFindGoodStuffData(holder, item, position);
        } else if ("type_211".equals(item.itemType)) {
            bindType211Data(holder, item, position);
        } else if ("type_Title".equals(item.itemType)) {
            bindTypeTitleData(holder, item, position);
        } else if ("type_22".equals(item.itemType)) {
            bindType22Data(holder, item, position);
        } else if ("type_1111".equals(item.itemType)) {
            bindType1111Data(holder, item, position);
        } else if ("type_middleBanner".equals(item.itemType)) {
            bindTypeMiddleBannerData(holder, item, position);
        } else if ("showEventFillUp".equals(item.itemType)) {
            bindShowEventFillUpData(holder, item, position);
        } else if ("findGoodShop".equals(item.itemType)) {
            bindFindGoodShopData(holder, item, position);
        } else if ("preferredList".equals(item.itemType)) {
            bindPreferredListData(holder, item, position);
        } else if ("live".equals(item.itemType)) {
            bindLiveData(holder, item, position);
        } else if ("recommended_ware".equals(item.itemType)) {
            bindRecommendedWareData(holder, item, position);
        } else if ("shopItem".equals(item.itemType)) {
            bindShopItemData(holder, item, position);
        } else if ("newUserReduce".equals(item.itemType)) {
            bindNewUserReduceData(holder, item, position);
        } else if ("photo".equals(item.itemType)) {
            bindPhoto(holder, item, position);
        } else if ("type_head".equals(item.itemType)) {
            bindHead(holder, item, position);
        }
    }


    @Override
    //重写此方法可实现动态设置每个item项在行、列中所占的份数
    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
        RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
        if (manager instanceof GridLayoutManager) {
            final GridLayoutManager gridManager = ((GridLayoutManager) manager);
            gridManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
                @Override
                /** 这个方法的返回值决定了我们每个position上的item占据的单元格个数 */
                public int getSpanSize(int position) {
                    //0xff18就是Constant.TYPE_RECOMMENDED_WARE,0xff19就是Constant.TYPE_SHOP_ITEM,凑合着用吧,骚年
                    if (getItemViewType(position) == Constant.TYPE_RECOMMENDED_WARE) {
                        return 2;
                    } else if (getItemViewType(position) == TYPE_NORMAL) {
                        return 1;
                    } else {
                        return gridManager.getSpanCount();
                    }
                }
            });
        }
    }

    /**
     * 绑定banner数据
     *
     * @param holder
     * @param item
     * @param position
     */
    private void bindTopBannerData(RecyclerViewHolder holder, final ShopMainJsonBean.ItemInfoListBean item, int position) {
        BGABanner banner = holder.getView(R.id.banner);
        banner.setDelegate(new BGABanner.Delegate<View, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean>() {
            @Override
            public void onBannerItemClick(BGABanner banner, View itemView, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model, int position) {
                onBindClickContext(item.itemContentList.get(position).clickType, item.itemContentList.get(position).clickValue);
            }
        });
        banner.setAdapter(new BGABanner.Adapter<View, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean>() {
            @Override
            public void fillBannerItem(BGABanner banner, View itemView, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model, int position) {
                SimpleDraweeView simpleDraweeView = itemView.findViewById(R.id.sdv_item_fresco_content);
                simpleDraweeView.setImageURI(model.picture_url);
            }
        });
        banner.setData(R.layout.homerecycle_top_banner_content, item.itemContentList, null);
    }

    private void bindRecommendedWareData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.recommended_img)).setImageURI(item.itemContentList.get(0).picture_url);
        holder.setText(R.id.recommended_title, item.itemContentList.get(0).title);
        holder.setText(R.id.recommended_price, item.itemContentList.get(0).itemSubTitle);
    }

    private void bindLiveData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {

        ((ExpandImageView) holder.getView(R.id.type_live_item_one_img1)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.type_live_item_two_img1)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.live_icon)).setImageURI(item.itemContentList.get(0).itemBackgroundImageUrl);
        ((ExpandImageView) holder.getView(R.id.live_icon1)).setImageURI(item.itemContentList.get(1).itemBackgroundImageUrl);


        holder.setText(R.id.type_live_item_one_title, item.itemContentList.get(0).title);
        holder.setText(R.id.type_live_one_sub_title, item.itemContentList.get(0).itemSubTitle);

        holder.setText(R.id.type_live_item_two_title, item.itemContentList.get(1).title);
        holder.setText(R.id.type_live_item_two_sub_title, item.itemContentList.get(1).itemSubTitle);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
    }

    private void bindPreferredListData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {

        ((ExpandImageView) holder.getView(R.id.type_preferred_list_item_two_img1)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.type_preferred_list_item_two_img2)).setImageURI(item.itemContentList.get(1).itemBackgroundImageUrl);
        ((ExpandImageView) holder.getView(R.id.type_preferred_list_item_one_img1)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.type_preferred_list_item_one_img2)).setImageURI(item.itemContentList.get(0).itemBackgroundImageUrl);


        holder.setText(R.id.type_preferred_list_item_one_title, item.itemContentList.get(0).title);
        holder.setText(R.id.type_preferred_list_item_two_title, item.itemContentList.get(1).title);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
    }

    private void bindFindGoodShopData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {

        ((ExpandImageView) holder.getView(R.id.type_find_good_shop_item_two_img1)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.type_find_good_shop_item_two_img2)).setImageURI(item.itemContentList.get(1).itemBackgroundImageUrl);
        ((ExpandImageView) holder.getView(R.id.type_find_good_shop_item_one_img1)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.type_find_good_shop_item_one_img2)).setImageURI(item.itemContentList.get(0).itemBackgroundImageUrl);
        holder.setText(R.id.type_find_good_shop_item_one_title, item.itemContentList.get(0).title);
        holder.setText(R.id.type_find_good_shop_item_one_sub_title, item.itemContentList.get(0).itemSubTitle);
        holder.setText(R.id.type_find_good_shop_item_one_shop_name, item.itemContentList.get(0).itemRecommendedLanguage);

        holder.setText(R.id.type_find_good_shop_item_two_title, item.itemContentList.get(1).title);
        holder.setText(R.id.type_find_good_shop_item_two_sub_title, item.itemContentList.get(1).itemSubTitle);
        holder.setText(R.id.type_find_good_shop_item_two_shop_name, item.itemContentList.get(1).itemRecommendedLanguage);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
    }

    private void bindShowEventFillUpData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.show_event_fill_up)).setImageURI(item.itemContentList.get(0).picture_url);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.show_event_fill_up));
        
    }

    private void bindTypeMiddleBannerData(RecyclerViewHolder holder, final ShopMainJsonBean.ItemInfoListBean item, int position) {
        BGABanner banner = holder.getView(R.id.middle_banner);
        banner.setDelegate(new BGABanner.Delegate<View, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean>() {
            @Override
            public void onBannerItemClick(BGABanner banner, View itemView, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model, int position) {
                onBindClickContext(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickValue);
            }
        });
        banner.setAdapter(new BGABanner.Adapter<View, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean>() {
            @Override
            public void fillBannerItem(BGABanner banner, View itemView, ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model, int position) {
                SimpleDraweeView simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.type_item_middle_banner_content);
                simpleDraweeView.setImageURI(Uri.parse(model.picture_url));
            }
        });

        banner.setData(R.layout.homerecycle_middle_banner_content, item.itemContentList, null);
    }

    private void bindType1111Data(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.type1111_item_one_img)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.type1111_item_two_img)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.type1111_item_three_img)).setImageURI(item.itemContentList.get(2).picture_url);
        ((ExpandImageView) holder.getView(R.id.type1111_item_four_img)).setImageURI(item.itemContentList.get(3).picture_url);

        holder.setText(R.id.type1111_item_one_title, item.itemContentList.get(0).title);
        holder.setText(R.id.type1111_item_two_title, item.itemContentList.get(1).title);
        holder.setText(R.id.type1111_item_three_title, item.itemContentList.get(2).title);
        holder.setText(R.id.type1111_item_four_title, item.itemContentList.get(3).title);

        holder.setText(R.id.type1111_item_one_sub_title, item.itemContentList.get(0).itemSubTitle);
        holder.setText(R.id.type1111_item_two_sub_title, item.itemContentList.get(1).itemSubTitle);
        holder.setText(R.id.type1111_item_three_sub_title, item.itemContentList.get(2).itemSubTitle);
        holder.setText(R.id.type1111_item_four_sub_title, item.itemContentList.get(3).itemSubTitle);

        holder.setTextColor(R.id.type1111_item_one_title, item.itemContentList.get(0).titleColor);
        holder.setTextColor(R.id.type1111_item_two_title, item.itemContentList.get(1).titleColor);
        holder.setTextColor(R.id.type1111_item_three_title, item.itemContentList.get(2).titleColor);
        holder.setTextColor(R.id.type1111_item_four_title, item.itemContentList.get(3).titleColor);

        holder.setTextColor(R.id.type1111_item_one_sub_title, item.itemContentList.get(0).itemSubTitleColor);
        holder.setTextColor(R.id.type1111_item_two_sub_title, item.itemContentList.get(1).itemSubTitleColor);
        holder.setTextColor(R.id.type1111_item_three_sub_title, item.itemContentList.get(2).itemSubTitleColor);
        holder.setTextColor(R.id.type1111_item_four_sub_title, item.itemContentList.get(3).itemSubTitleColor);

        setRecommendedLanguage(holder, item, R.id.type1111_item_one_subscript, 0);
        setRecommendedLanguage(holder, item, R.id.type1111_item_two_subscript, 1);
        setRecommendedLanguage(holder, item, R.id.type1111_item_three_subscript, 2);
        setRecommendedLanguage(holder, item, R.id.type1111_item_four_subscript, 3);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
        onBindClick(item.itemContentList.get(2).clickType, item.itemContentList.get(2).clickUrl, holder.getView(R.id.item_three));
        onBindClick(item.itemContentList.get(3).clickType, item.itemContentList.get(3).clickUrl, holder.getView(R.id.item_four));
    }

    private void bindType22Data(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.type22_item_one_img)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.type22_item_two_img)).setImageURI(item.itemContentList.get(1).picture_url);
        holder.setText(R.id.type22_item_one_title, item.itemContentList.get(0).title);
        holder.setText(R.id.type22_item_one_sub_title, item.itemContentList.get(0).itemSubTitle);
        holder.setTextColor(R.id.type22_item_one_title, item.itemContentList.get(0).titleColor);
        holder.setTextColor(R.id.type22_item_one_sub_title, item.itemContentList.get(0).itemSubTitleColor);

        holder.setText(R.id.type22_item_two_title, item.itemContentList.get(1).title);
        holder.setText(R.id.type22_item_two_sub_title, item.itemContentList.get(1).itemSubTitle);
        holder.setTextColor(R.id.type22_item_two_title, item.itemContentList.get(1).titleColor);
        holder.setTextColor(R.id.type22_item_two_sub_title, item.itemContentList.get(1).itemSubTitleColor);


        setRecommendedLanguage(holder, item, R.id.type22_item_one_recommendedLanguage, 0);
        setRecommendedLanguage(holder, item, R.id.type22_item_two_recommendedLanguage, 1);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
    }

    private void bindTypeTitleData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.type_title_img)).setImageURI(item.itemContentList.get(0).picture_url);
        if (!TextUtils.isEmpty(item.itemContentList.get(0).title)) {
            holder.getView(R.id.type_title_more_ll).setVisibility(View.VISIBLE);
            holder.setText(R.id.type_title_more_text, item.itemContentList.get(0).title);
            if ("loveLife".equals(item.module) || "findGoodShop".equals(item.module) || "preferredList".equals(item.module) || "live".equals(item.module)) {
                ((ExpandImageView) holder.getView(R.id.type_title_arrow_img)).setImageResource(R.mipmap.orange_arrow);
            } else if ("goShopping".equals(item.module)) {
                ((ExpandImageView) holder.getView(R.id.type_title_arrow_img)).setImageResource(R.mipmap.go_shopping_rt);
            }
        } else {
            holder.getView(R.id.type_title_more_ll).setVisibility(View.GONE);
        }
    }

    private void bindType211Data(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        holder.setText(R.id.item_one_title, item.itemContentList.get(0).title);
        holder.setText(R.id.item_two_title, item.itemContentList.get(1).title);
        holder.setText(R.id.item_three_title, item.itemContentList.get(2).title);

        holder.setText(R.id.item_one_sub_title, item.itemContentList.get(0).itemSubTitle);
        holder.setText(R.id.item_two_sub_title, item.itemContentList.get(1).itemSubTitle);
        holder.setText(R.id.item_three_sub_title, item.itemContentList.get(2).itemSubTitle);

        holder.setTextColor(R.id.item_one_title, item.itemContentList.get(0).titleColor);
        holder.setTextColor(R.id.item_two_title, item.itemContentList.get(1).titleColor);
        holder.setTextColor(R.id.item_three_title, item.itemContentList.get(2).titleColor);

        holder.setTextColor(R.id.item_one_sub_title, item.itemContentList.get(0).itemSubTitleColor);
        holder.setTextColor(R.id.item_two_sub_title, item.itemContentList.get(1).itemSubTitleColor);
        holder.setTextColor(R.id.item_three_sub_title, item.itemContentList.get(2).itemSubTitleColor);
        ((ExpandImageView) holder.getView(R.id.item_one_img)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.item_two_img)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.item_three_img)).setImageURI(item.itemContentList.get(2).picture_url);

        setRecommendedLanguage(holder, item, R.id.item_one_subscript, 0);
        setRecommendedLanguage(holder, item, R.id.item_two_subscript, 1);
        setRecommendedLanguage(holder, item, R.id.item_three_subscript, 2);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
        onBindClick(item.itemContentList.get(2).clickType, item.itemContentList.get(2).clickUrl, holder.getView(R.id.item_three));
    }

    private void bindFindGoodStuffData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        holder.setText(R.id.find_good_stuff_left_title, item.itemContentList.get(0).title);
        holder.setText(R.id.find_good_stuff_left_sub_title, item.itemContentList.get(0).itemSubTitle);
        holder.setText(R.id.find_good_stuff_right_title, item.itemContentList.get(1).title);
        holder.setText(R.id.title_desc, item.itemContentList.get(1).itemSubTitle);

        ((ExpandImageView) holder.getView(R.id.find_good_stuff_left_img)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.find_good_stuff_right_img)).setImageURI(item.itemContentList.get(1).picture_url);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.item_one));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.item_two));
    }

    private void bindShowEventData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.show_event_left_img)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.show_event_middle_img)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.show_event_right_img)).setImageURI(item.itemContentList.get(2).picture_url);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.show_event_left_img));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.show_event_middle_img));
        onBindClick(item.itemContentList.get(2).clickType, item.itemContentList.get(2).clickUrl, holder.getView(R.id.show_event_right_img));
    }


    private void bindJDSpikeHeaderData(final RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        holder.setText(R.id.spike_time_field, item.itemContentList.get(0).title);
        holder.setText(R.id.spike_header_desc, item.itemContentList.get(0).itemSubTitle);
        String time = item.itemContentList.get(0).itemRecommendedLanguage;
        if (TextUtils.isEmpty(time) || !time.matches("^[0-9]*$"))
            return;
        if (timer != null) {
            timer.cancel();
            timer = null;
        }
        timer = new CountDownTimer(Long.parseLong(time), 1000) {
            @Override
            public void onTick(long millisUntilFinished) {
                long temp = millisUntilFinished / 1000;
                long hours = temp / 3600;
                long minutes = (temp - (3600 * hours)) / 60;
                long seconds = temp - (3600 * hours) - (60 * minutes);
                holder.setText(R.id.spike_time_hour, hours > 9 ? "" + hours : "0" + hours);
                holder.setText(R.id.spike_time_minute, minutes > 9 ? "" + minutes : "0" + minutes);
                holder.setText(R.id.spike_time_seconds, seconds > 9 ? "" + seconds : "0" + seconds);

            }

            @Override
            public void onFinish() {
                holder.setText(R.id.spike_time_hour, "00");
                holder.setText(R.id.spike_time_minute, "00");
                holder.setText(R.id.spike_time_seconds, "00");
            }
        }.start();
    }


    private void bindJDBulletinData(RecyclerViewHolder holder, final ShopMainJsonBean.ItemInfoListBean item, final int position) {
        UpDownViewSwitcher viewSwitcher = holder.getView(R.id.home_view_switcher);
        viewSwitcher.setSwitcheNextViewListener(new UpDownViewSwitcher.SwitchNextViewListener() {
            @Override
            public void switchTONextView(View nextView, final int index) {
                if (nextView == null) return;
                final String title = item.itemContentList.get(index % item.itemContentList.size()).title;
                final String titleColor = item.itemContentList.get(index % item.itemContentList.size()).titleColor;
                final String subTitle = item.itemContentList.get(index % item.itemContentList.size()).itemSubTitle;
                final String subTitleColor = item.itemContentList.get(index % item.itemContentList.size()).itemSubTitleColor;
                ((TextView) nextView.findViewById(R.id.textview)).setText(subTitle);
                ((TextView) nextView.findViewById(R.id.textview)).setTextColor(Color.parseColor(subTitleColor));
                ((TextView) nextView.findViewById(R.id.switch_title_text)).setText(title);
                ((TextView) nextView.findViewById(R.id.switch_title_text)).setTextColor(Color.parseColor(titleColor));
                nextView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        onBindClickContext(item.itemContentList.get(index % item.itemContentList.size()).clickType, item.itemContentList.get(index % item.itemContentList.size()).clickValue);
                    }
                });
            }
        });
        viewSwitcher.setContentLayout(R.layout.switch_view);
    }

    private void bindNewUserData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {

        ((ExpandImageView) holder.getView(R.id.new_user_bg_img)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.new_user_red_envelopes)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.new_uer_free_postage)).setImageURI(item.itemContentList.get(2).picture_url);
        ((ExpandImageView) holder.getView(R.id.new_user_basic_necessities_of_life)).setImageURI(item.itemContentList.get(3).picture_url);
        ((ExpandImageView) holder.getView(R.id.new_user_packs)).setImageURI(item.itemContentList.get(4).picture_url);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.new_user_bg_img));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.new_user_red_envelopes));
        onBindClick(item.itemContentList.get(2).clickType, item.itemContentList.get(2).clickUrl, holder.getView(R.id.new_uer_free_postage));
        onBindClick(item.itemContentList.get(3).clickType, item.itemContentList.get(3).clickUrl, holder.getView(R.id.new_user_basic_necessities_of_life));
        onBindClick(item.itemContentList.get(4).clickType, item.itemContentList.get(4).clickUrl, holder.getView(R.id.new_user_packs));
    }

    private void bindNewUserReduceData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        ((ExpandImageView) holder.getView(R.id.new_user_reduce_left)).setImageURI(item.itemContentList.get(0).picture_url);
        ((ExpandImageView) holder.getView(R.id.new_user_reduce_right_top)).setImageURI(item.itemContentList.get(1).picture_url);
        ((ExpandImageView) holder.getView(R.id.new_user_reduce_right_bottom)).setImageURI(item.itemContentList.get(2).picture_url);

        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.new_user_reduce_left));
        onBindClick(item.itemContentList.get(1).clickType, item.itemContentList.get(1).clickUrl, holder.getView(R.id.new_user_reduce_right_top));
        onBindClick(item.itemContentList.get(2).clickType, item.itemContentList.get(2).clickUrl, holder.getView(R.id.new_user_reduce_right_bottom));
    }

    private void bindIconListData(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        if (!TextUtils.isEmpty(item.itemContentList.get(0).itemBackgroundImageUrl)) {
            ((ExpandImageView) holder.getView(R.id.icon_list_bg)).setImageURI(item.itemContentList.get(0).itemBackgroundImageUrl);
        } else {
            ((ExpandImageView) holder.getView(R.id.icon_list_bg)).setImageResource(0);
        }
        int viewHeight = (int) (AndroidUtil.getWindowWith() / 2.25f);//这个高度与背景图片比例对应,具体可看布局
        ((DecoratorViewPager) holder.getView(R.id.viewPager)).getLayoutParams().height = viewHeight;
        //使用拦截滑动事件,让viewPage的滑动不响应RecyclerView
//        ((DecoratorViewPager)holder.getView(R.id.viewPager)).setNestedpParent((ViewGroup) ((DecoratorViewPager)holder.getView(R.id.viewPager)).getParent());

        ((DecoratorViewPager) holder.getView(R.id.viewPager)).setVisibility(View.VISIBLE);
        ((DecoratorViewPager) holder.getView(R.id.viewPager)).setAdapter(new ViewPagerAdapter(item.itemContentList, viewHeight, 2, 3));
    }

    private void bindShopItemData(RecyclerViewHolder holder, final ShopMainJsonBean.ItemInfoListBean item, final int position) {
        final ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model = item.itemContentList.get(0);
        holder.setText(R.id.name, model.title);

        if(model.pics!=null && model.pics.length>0){
            for(int i=0;i<model.pics.length;i++){
                switch (i){
                    case 0:
                        ((ExpandImageView) holder.getView(R.id.image1)).setImageURI(model.pics[i]);break;
                    case 1:
                        ((ExpandImageView) holder.getView(R.id.image2)).setImageURI(model.pics[i]);break;
                    case 2:
                        ((ExpandImageView) holder.getView(R.id.image3)).setImageURI(model.pics[i]);break;
                }
            }
            switch (model.pics.length){
                case 1:
                    ((ExpandImageView) holder.getView(R.id.image1)).setVisibility(View.VISIBLE);
                    ((ExpandImageView) holder.getView(R.id.image2)).setVisibility(View.INVISIBLE);
                    ((ExpandImageView) holder.getView(R.id.image3)).setVisibility(View.INVISIBLE);
                    break;
                case 2:
                    ((ExpandImageView) holder.getView(R.id.image1)).setVisibility(View.VISIBLE);
                    ((ExpandImageView) holder.getView(R.id.image2)).setVisibility(View.VISIBLE);
                    ((ExpandImageView) holder.getView(R.id.image3)).setVisibility(View.INVISIBLE);
                    break;
                case 3:
                    ((ExpandImageView) holder.getView(R.id.image1)).setVisibility(View.VISIBLE);
                    ((ExpandImageView) holder.getView(R.id.image2)).setVisibility(View.VISIBLE);
                    ((ExpandImageView) holder.getView(R.id.image3)).setVisibility(View.VISIBLE);
                    break;
            }
        }else {
            ((ExpandImageView) holder.getView(R.id.image1)).setVisibility(View.GONE);
            ((ExpandImageView) holder.getView(R.id.image2)).setVisibility(View.GONE);
            ((ExpandImageView) holder.getView(R.id.image3)).setVisibility(View.GONE);
        }

        //用户信息
        ((CircleImageView) holder.getView(R.id.head)).setImageURI(model.head_img);
        holder.setText(R.id.nice, model.nickname);
        holder.setText(R.id.time, model.ctime);
        holder.setText(R.id.pageview, model.views+"人浏览");
        onBindClick("7", model.id, holder.itemView);
        
//        holder.setOnItemClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                ARouter.getInstance()
//                        .build("/comn/ComnGoodsItemInfoRUI")
//                        .withString("id", model.id)
//                        .withString("commentRequestPath","Comment/getSpecialtyComment")
//                        .withString("headRequestPath","Floor/getBannerProductDetail")
//                        .withString("type","2")
//                        .withString("collection_count",model.collection_count)
//                        .navigation();
//            }
//        });

        holder.setOnItemClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ARouter.getInstance().build("/main/MainSpecialtyInfoRUI")
                        .withString("type","2")
                        .withString("id", model.id)
                        .withInt("position", position)
                        .withString("collection_count", model.collection_count)
                        .navigation();
            }
        });
    }

    private void bindPhoto(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        BaseImage.getInstance().loadAutoHeight(((ExpandImageView) holder.getView(R.id.photo)), item.itemContentList.get(0).picture_url, AndroidUtil.getWindowWith());
        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.getView(R.id.photo));
    }

    private void bindHead(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int position) {
        holder.setText(R.id.title, item.itemContentList.get(0).title);
        holder.setText(R.id.subTitle, item.itemContentList.get(0).itemSubTitle);
        onBindClick(item.itemContentList.get(0).clickType, item.itemContentList.get(0).clickUrl, holder.itemView);
    }


    /**
     * 填充下标 或 推荐 内容
     *
     * @param holder
     * @param item
     * @param id
     * @param index
     */
    private void setRecommendedLanguage(RecyclerViewHolder holder, ShopMainJsonBean.ItemInfoListBean item, int id, int index) {
        String itemRecommendedLanguage = item.itemContentList.get(index).itemRecommendedLanguage;
        if (TextUtils.isEmpty(itemRecommendedLanguage)) {
            holder.getView(id).setVisibility(View.GONE);
        } else {
            holder.getView(id).setVisibility(View.VISIBLE);
            BaseImage.getInstance().loadAutoWidth((ExpandImageView) holder.getView(id), itemRecommendedLanguage, AndroidUtil.getWindowWith() / 30);
            //            ((ExpandImageView) holder.getView(id)).setImageURI(itemRecommendedLanguage);
            //            if ("loveLife".equals(item.module)) {
            //                holder.getView(id).setBackgroundResource(R.drawable.home_love_life_subscript_gradient_bg);
            //            } else 
            //            if ("enjoyQuality".equals(item.module)) {
            //                holder.getView(id).setBackgroundResource(R.drawable.home_enjoy_quality_subscript_gradient_bg);
            //            } else 
            //            if ("buyFeatures".equals(item.module)) {
            //                holder.getView(id).setBackgroundResource(R.drawable.home_buy_feature_subscript_gradient_bg);
            //            } else
            //            if ("ranking".equals(item.module)) {
            //                holder.getView(id).setBackgroundResource(R.drawable.home_love_life_subscript_gradient_bg);
            //            }
        }
    }


    class ViewPagerAdapter extends PagerAdapter {
        List<View> viewList = new ArrayList<View>();
        List<ShopMainJsonBean.ItemInfoListBean.ItemContentListBean> datas;

        /**
         * @param datas      需要显示的数据
         * @param viewHeight 高度
         * @param lines      显示行数
         * @param columns    显示列数
         */
        public ViewPagerAdapter(List<ShopMainJsonBean.ItemInfoListBean.ItemContentListBean> datas, int viewHeight, int lines, int columns) {
            this.datas = datas;
            //每页显示数量
            int theItemNumber = lines * columns;
            if (datas.size() % theItemNumber == 0) {
                //数据能被刚好显示完
                //需要多少页能显示完
                int pages = datas.size() / theItemNumber;
                viewList = new ArrayList<View>(pages);
                for (int i = 0; i < pages; i++) {
                    List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
                    for (int j = i * theItemNumber; j < i * theItemNumber + theItemNumber; j++) {
                        ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model = datas.get(j);
                        HashMap<String, String> map = new HashMap<String, String>();
                        map.put("value", model.clickValue);
                        map.put("type", model.clickType);
                        map.put("path", model.picture_url);
                        map.put("name", model.title);
                        map.put("titleColor", model.titleColor);
                        list.add(map);
                    }
                    View view = mActivity.getLayoutInflater().inflate(R.layout.item_vp_gr, null);
                    GridView gridView = view.findViewById(R.id.gridView);
                    gridView.setNumColumns(columns);
                    gridView.getLayoutParams().height = viewHeight;
                    gridView.setAdapter(new sGridViewAdapter(mActivity, list, R.layout.item_gr_vp, new String[]{"name"}, new int[]{R.id.name}, viewHeight, lines, columns, 0.6));
                    viewList.add(view);
                }
            } else {
                //数据不能被刚好显示完(这时候总页码需要+1)
                int pages = (datas.size() / theItemNumber) + 1;
                viewList = new ArrayList(pages);
                for (int i = 0; i < pages; i++) {
                    List<HashMap<String, String>> resourceList = new ArrayList<HashMap<String, String>>();
                    int maxIndex = 0;
                    if (datas.size() - i * theItemNumber > theItemNumber) {
                        maxIndex = i * theItemNumber + theItemNumber;
                    } else {
                        maxIndex = datas.size();
                    }
                    for (int j = i * theItemNumber; j < maxIndex; j++) {
                        ShopMainJsonBean.ItemInfoListBean.ItemContentListBean model = datas.get(j);
                        HashMap<String, String> map = new HashMap<String, String>();
                        map.put("value", model.clickValue);
                        map.put("type", model.clickType);
                        map.put("path", model.picture_url);
                        map.put("name", model.title);
                        map.put("titleColor", model.titleColor);
                        resourceList.add(map);
                    }
                    View view = mActivity.getLayoutInflater().inflate(R.layout.item_vp_gr, null);
                    GridView gridView = view.findViewById(R.id.gridView);
                    gridView.setNumColumns(columns);
                    gridView.getLayoutParams().height = viewHeight;
                    gridView.setAdapter(new sGridViewAdapter(mActivity, resourceList, R.layout.item_gr_vp, new String[]{"name"}, new int[]{R.id.name}, viewHeight, lines, columns, 0.6));
                    viewList.add(view);
                }
            }
        }
        
        @Override
        public int getCount() {
            return viewList.size();
        }

        /**
         * 从当前container中删除指定位置（position）的View
         */
        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView(viewList.get(position));
        }

        /**
         * 做了两件事，第一：将当前视图添加到container中，第二：返回当前View
         */
        @Override
        public Object instantiateItem(ViewGroup container, int position) {
            container.addView(viewList.get(position));
            return viewList.get(position);
        }

        @Override
        public boolean isViewFromObject(View arg0, Object arg1) {
            return arg0 == arg1;
        }

    }

    private class sGridViewAdapter extends SimpleAdapter {
        private List<HashMap<String, String>> list;
        private int lineNumber = 2;//行数
        private int lineHeight = 0;//行高
        private int columnNumber = 5;//列数
        private int columnWidth = 0;//列宽
        private double imageWeight = 0.7;//图片大小权重(找到小的一边,以小边为基准计算宽高)
        private int imageWidth = 0;
        private int imageHeight = 0;

        public sGridViewAdapter(Context context, List<? extends Map<String, ?>> list, int resource, String[] from, int[] to, int gridViewHeight, int lineNumber, int columnNumber) {
            super(context, list, resource, from, to);
            this.list = (List<HashMap<String, String>>) list;
            this.lineNumber = lineNumber;
            this.columnNumber = columnNumber;
            lineHeight = gridViewHeight / lineNumber;
            columnWidth = AndroidUtil.getWindowWith() / columnNumber;
            imageWeight = 0.7;
            if (lineHeight <= columnWidth) {//找到小的一边,以小边为基准
                imageWidth = (int) (lineHeight * imageWeight);
                imageHeight = (int) (lineHeight * imageWeight);
            } else {
                imageWidth = (int) (columnWidth * imageWeight);
                imageHeight = (int) (columnWidth * imageWeight);
            }
        }

        public sGridViewAdapter(Context context, List<? extends Map<String, ?>> list, int resource, String[] from, int[] to, int gridViewHeight, int lineNumber, int columnNumber, double imageWeight) {
            super(context, list, resource, from, to);
            this.list = (List<HashMap<String, String>>) list;
            this.lineNumber = lineNumber;
            this.columnNumber = columnNumber;
            lineHeight = gridViewHeight / lineNumber;
            columnWidth = AndroidUtil.getWindowWith() / columnNumber;
            if (lineHeight <= columnWidth) {//找到小的一边,以小边为基准
                imageWidth = (int) (lineHeight * imageWeight);
                imageHeight = (int) (lineHeight * imageWeight);
            } else {
                imageWidth = (int) (columnWidth * imageWeight);
                imageHeight = (int) (columnWidth * imageWeight);
            }

        }

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            View view = super.getView(position, convertView, parent);
            view.getLayoutParams().width = columnWidth;
            view.getLayoutParams().height = lineHeight;
            ((TextView) view.findViewById(R.id.name)).setTextColor(Color.parseColor(list.get(position).get("titleColor")));
//            ((TextView) view.findViewById(R.id.name)).setTextColor(Color.parseColor("#333333"));
            //设置图片的宽高
            android.widget.LinearLayout.LayoutParams imageLp = new android.widget.LinearLayout.LayoutParams(imageWidth, imageHeight);
            ((SimpleDraweeView) view.findViewById(R.id.image)).setLayoutParams(imageLp);
            ((SimpleDraweeView) view.findViewById(R.id.image)).setImageURI(list.get(position).get("path"));
            onBindClick(list.get(position).get("type"), list.get(position).get("value"), view);
            return view;
        }
    }

    //绑定View的点击事件
    public void onBindClick(final String type, final String value, View view) {
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                onBindClickContext(type, value);
            }
        });
    }

    //绑定View的点击事件的执行内容
    public void onBindClickContext(String type, final String value) {
        if (!Util.isEmpty(type)) {
            switch (Integer.parseInt(type)) {
                case 0://轮播
                    Intent in4 = new Intent(mActivity, XWebViewActivity.class);
                    in4.putExtra("url", value);
                    mActivity.startActivity(in4);
                    break;
                case 1://便民信息
                    ARouter.getInstance().build("/main/MainConvenientLifeUI").navigation();
                    break;
                case 2://五峰旅游
                    ARouter.getInstance().build("/main/MainTourRUI").navigation();
                    break;
                case 3://五峰乡镇网
                    ARouter.getInstance().build("/main/MainTownShipRUI").navigation();
                    break;
                case 4://五峰原创
                    ARouter.getInstance().build("/main/MainOriginalUI").navigation();
                    break;
                case 5://五峰特产
                    ARouter.getInstance().build("/main/MainSpecialtyRUI").navigation();
                    break;
                case 6://打开网页
                    Intent in3 = new Intent(mActivity, XWebViewActivity.class);
                    in3.putExtra("url", value);
                    mActivity.startActivity(in3);
                    break;
                case 7://商品(商品详情)
                    
                    break;
                default:
                    break;
            }
        }
    }

    //获取徽章Drawable
    public GradientDrawable getBadgeDrawable(Context context) {
        GradientDrawable shape = new GradientDrawable();
        shape.setShape(GradientDrawable.RECTANGLE);
        shape.setCornerRadius(context.getResources().getDimensionPixelSize(R.dimen.badge_corner_radius));
        shape.setColor(ContextCompat.getColor(context, R.color.title_c_7f_black));//BackgroundColor
        shape.setStroke(0, ContextCompat.getColor(context, R.color.white));//BorderWidth,BorderColor
        return shape;
    }
}
